/**
 * @description 地点相关的API处理
 */

import { post } from "@/util/request"

// 获取签到列表
const getAsignList = async ({
    url = "/asign-api/getAsignList",
    params = Object,
    success = Function,
    error = Function,
    complete = Function,
}) => {
    try {
        const res = await post(url, {
            ...params
        })
        if (res.status === "0000") {
            success(res.data);
        } else {
            error(res)
        }

    } catch (error) {
        error(error)
    } finally {
        complete()
    }
}


// 删除签到
const deleteAsign=async ({
    url = "/asign-api/deleteAsign",
    params = Object,
    success = Function,
    error = Function,
    complete = Function,
}) => {
    try {
        const res = await post(url, {
            ...params
        })
        if (res.status === "0000") {
            success(res);
        } else {
            error(res)
        }

    } catch (error) {
        error(error)
    } finally {
        complete()
    }
}
// 添加签到
const addSign = async ({ url = String, params = Object, success = () => { }, fail = () => { }, complete = () => { } }) => {
   
    try {
        const res = await post(url, {
            ...params
        })
        console.log("调用了新建表单函数",res)
        if (res.status === "0000") {
            success(res)
        }

    } catch (error) {
        fail(error)
    } finally {
        complete()
    }
}
export {
    getAsignList,deleteAsign,addSign
}